{PREFIX} = require "~config.coffee"

session = require './session'
$.ajaxPrefilter(( options , optionsOld, xhr) ->
    url = options.url
    if url.charAt(0) == "*"
        options.url = PREFIX + options.url.slice(1)
        options.crossDomain = true
        headers = options.headers or {}
        if not headers.I
            headers.I = session.I
        options.headers = headers
    return options
)
